package com.pethome.web.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.pethome.common.core.domain.BaseEntity;
import com.pethome.common.core.domain.entity.Customer;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 *  todo mybatis 常  一对一查询 的方法
 */
@Data
@Accessors(chain=true)//作用，开启链式编程
@NoArgsConstructor
public class PostAndCustomer extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /** id */
    private Long postId;

    /** 顾客id */
    private Long postCustomerId;

    /** 标题 */
    private String postTitle;

    /** 照片 */
    private String postImages;

    /** 内容 */
    private String postContent;

    /** 浏览量 */
    private Long postReadCount;

    /** 收藏量 */
    private Long postLikeCount;

    /** 发布时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date postCreateAt;

    /** 顾客姓名 查找全部文章和文章对应的顾客 */
    private Customer customer;

    @Override
    public String toString() {
        return "PostAndCustomer{" +
                "postId=" + postId +
                ", postCustomerId=" + postCustomerId +
                ", postTitle='" + postTitle + '\'' +
                ", postImages='" + postImages + '\'' +
                ", postContent='" + postContent + '\'' +
                ", postReadCount=" + postReadCount +
                ", postLikeCount=" + postLikeCount +
                ", postCreateAt=" + postCreateAt +
                ", customer=" + customer.toString() +
                '}';
    }
}
